<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>

<script type="text/javascript">
	
var a = [];
for (let i = 0; i < 10; i++) {
	a[i] = function () {
		console.error(i);
	}
}

for (k = 0; k < a.length; k++) {
	a[k]();
}

</script>

</body>
</html>